* Prepare tariffs from WDI

import delimited using "WDITariffs/input/WDI_Tariffs", varname(1) clear
egen series = group(seriesname)  // series = 4 is applied, weigthed mean, all products (%)
rename countrycode Country
egen CountrySeries = group(Country series)
drop if CountrySeries ==.
reshape long yr, i(CountrySeries) j(year)
rename yr tariff
sort Country year tariff
order CountrySeries, last
order Country, first
destring tariff, replace force
drop seriesname seriescode CountrySeries
egen CountryYear = group(Country year)
reshape wide tariff, i(CountryYear) j(series)
ren Country ccode
ren tariff2 tariff4
order year, first
order ccode, first
keep if year<=2016
save "WDITariffs/output/tariffs.dta", replace
